<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class List_user extends CI_Controller{
	
	function __construct()
	{
		parent::__construct();
		$this->load->model('admin_model');
	}
	
	function index()
	{
		$data['list_user'] = $this->admin_model->get_list_user();
		$this->load->view('list_user', $data);
	}
	
	function aktifkan($id)
	{		
		/*$email_tujuan = $this->admin_model->get_email($id);
		$email_admin = $this->admin_model->get_email($this->session->userdata('id_user'));
		
		//var_dump($email_admin[0]['email']);
		//var_dump($email_tujuan[0]['email']);
		//$this->email->from($email_admin[0]['email'], $email_admin[0]['nama']);
		//$this->email->to($email_tujuan[0]['email']);
		
		$ci = get_instance();
		$ci->load->library('email');
		/*$config['protocol'] = "smtp";
		$config['smtp_host'] = "ssl://smtp.googlemail.com";
		$config['smtp_port'] = "465";
		$config['smtp_user'] = "addies.ababa1@gmail.com"; 
		$config['smtp_pass'] = "rahasiayo";
		$config['charset'] = "utf-8";
		$config['mailtype'] = "html";
		$config['newline'] = "\r\n";

		$ci->email->initialize($config);

		$ci->email->from($email_admin[0]['email'], $email_admin[0]['nama']);
		$list = array($email_tujuan[0]['email']);
		$ci->email->to($list);
		//$this->email->reply_to('my-email@gmail.com', 'Explendid Videos');
		$ci->email->subject('This is an email test');
		$ci->email->message('It is working. Great!');
		$ci->email->send();*/
		
		$this->admin_model->update_status_user(1, $id);
		redirect('admin/list_user');
	}
	
	function nonaktifkan($id)
	{
		$this->admin_model->update_status_user(0, $id);
		redirect('admin/list_user');
	}
	
}
?>